﻿Namespace Genel
	Module Functions

		Function SistemTarihiTuru(ByVal Process As Token) As String
			Dim Rs As Recordset = Process.OpenSQL("select * from genel")
			Return If(Trim(Rs("sysdate")) = "", "O", "M")
		End Function

		Function SistemTarihi(ByVal Process As Token) As Date
			Dim Rs As Recordset = Process.OpenSQL("select * from genel")
			Return If(Trim(Rs("sysdate")) = "", Today.Date, ToDate(Rs("sysdate")))
		End Function

		Sub SistemTarihiDegistir(ByVal Token As Token, ByVal tur As String, ByVal tarih As String)
			Token.ExecSQL("update genel set sysdate = @d", If(tur = "O", "", tarih))
		End Sub

		Sub Log(Token As Token, Tablo As String, Islem As String, ID As Long, Kaykul As String)
			Token.ExecSQL("insert into islem (tablo,islem,id,tarih,kaykul) values (@tablo,@islem,@id,getdate(),@kaykul)", Tablo, Islem, ID, User.Kaykul)
		End Sub

	End Module
End Namespace
